package com.example.threaddemo.other;

import java.io.Serializable;
import java.util.concurrent.Callable;

public class ThreadDemo implements Serializable {
    private static final long serialVersionUid = 123L;
    public static void main(String[] args) {
        Thread1 t1 = new Thread1();
        t1.start();

        Thread t2 = new Thread(new Thread2());
        t2.start();

//        Thread t3 = new Thread(new Thread3());
//        t3.start();

    }
}

class Thread1 extends Thread{
    @Override
    public void run() {
        System.out.println(Thread.currentThread().getName() + ":run1-----------------");
    }
}

class Thread2 implements Runnable{

    @Override
    public void run() {
        System.out.println(Thread.currentThread().getName() + ":run2-----------------");
    }
}

class Thread3 implements Callable<Boolean>{

    @Override
    public Boolean call() throws Exception {
        System.out.println(Thread.currentThread().getName() + ":run3-----------------");
        return false;
    }
}